﻿package com.zretc.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016103000778512";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDbjzJPya9icDcEHmdcGhzlKeBN8UbELpee1RM05wPL0qsM58ROFMaq6bSyMyEmTP659RUQd46JHoqqGI/z6FIodFyd4EFQrs5AZ92DYOeCAIBCnKI0WcrXteK7q7avjQiyMDxNF534vK5PuGvfBGv+4B4U6juC1xknJBL/NFE/NwkkPRIlpAGBXJrwmJIWkGoNNjo8EtWqKrxr5kLiyXcR1pERAQJnC4mA+vOJFUg364J3NEgs8Rv/ZjsDYpzZD1hAt2JD0pAtnwv4LxOsA1ibJpK75Nd7YlWqAGpGWLergc5nUxbRqjHwZFn8ADZbqkdCsuDWDHqZLv5wjQy+AXvjAgMBAAECggEAAoTyHthBmu+Osg1nQjdKfZatbDeIiFfAhaIMRl8gPAZ+z/cY2YyDexKTcDgF+VqI0bluNHIqwIgJL0p43GOeDbjIF0ereDGJTFPkxs0l2ugGkL0bX15oZXFA2MZvojQMFX9YMcpDlccUePW0xypV0ubfcX3+kNHHCBvx29vN0tvZW8WqK7AewRl5AWiYLbtuPe/thO7LLbHgQIbkqwCl3mgr0frwwaIcmk/4eNiPUCWCeyNvIUcs12GWIlDyhhYZXapaCEr9CzXd9higd8RmSxn2QvXsXo/Xg8Bmu0MUbqRm2Xnuy6h0w2Z90ABiVwZ8aelA5ppcMPMeM4i20MCrgQKBgQD7XN/MD7yrN4HqOQaudn6c3KRqZrfvDvkcZQpWBLnsiryXUWSCVqUT6hR2mbHdmCap9ipIec98UMNi/PNHqseGSXqCBA+sUx/pXeP8PhwIUwMJcIQoK8wIUeHmG2O6ziBVB5EkUzIDhfe83xlDKiDv42DpOPdVkZp7vLFsnOkxfwKBgQDfnB9V9yqXPCjz0kJev4WOFfVmsHuLNLUMJRuEu5H3ySFjOpYfMBrN9KmgD7fJs+oUMsUkOSe19frWslJzd5m1cz+zxjjnMKeWXCK6sw4Z+8vsYnazOxb0+NQjmf/8R09DoNpdhuT5W7MCZFMWzH1G5Y+l9dhHTp+xdZa9lmBfnQKBgHsPVA2eYrrcOQFHm+rL3l7DcscYtNIX3YO2P+Iu/Cs/HOdkFLXu33CpeA08X6TiOYOaHcdPw3HURGPw/NXIWVh4Hr8KZ/Xw2D2zFsvGSIkWwvTbHghgsMod9F9oZ2HsSk32n2tOQ70P2GKiQsbsGCX5hteHaSd+Wkhb7+0BwPTXAoGBAMZsOJZFBQM8vC5YNtLy6qWBsMiV9Js7gyiqyPeIpmeVj84Iz+wO+MonwFmrePBAeYfA4ZVaLnXWN+dKR8X0rG4KPc3eKOJmF2Bik+LOPsYp3PP/D8vNtHpfT4fkAPaxpJGjbAIwUIFBsOB/fAewH77IuCaRuIDWMPj9Gm1TwmM1AoGBAO7NSYUAyBb+JuonAOJggAvUN1u/gU6zLdH81I5KspR+Yw2jhvLM9wyCbu6qBxPQr//3HYxXybmbjl+3/qJKcswWWO5tekizpcDob61oCcP4sur9YVbPhkDJpttAuiNGexZD+t95vEL6SxzG12kvv3zoOaO/uNIZ6OdqFXyQks4c";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA248yT8mvYnA3BB5nXBoc5SngTfFGxC6XntUTNOcDy9KrDOfEThTGqum0sjMhJkz+ufUVEHeOiR6KqhiP8+hSKHRcneBBUK7OQGfdg2DnggCAQpyiNFnK17Xiu6u2r40IsjA8TRed+LyuT7hr3wRr/uAeFOo7gtcZJyQS/zRRPzcJJD0SJaQBgVya8JiSFpBqDTY6PBLVqiq8a+ZC4sl3EdaREQECZwuJgPrziRVIN+uCdzRILPEb/2Y7A2Kc2Q9YQLdiQ9KQLZ8L+C8TrANYmyaSu+TXe2JVqgBqRli3q4HOZ1MW0aox8GRZ/AA2W6pHQrLg1gx6mS7+cI0MvgF74wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/DoCoMusic/shaxiang/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/DoCoMusic/shaxiang/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl ="https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

